<template>
<van-nav-bar title="详情页" left-text="返回" left-arrow @click-left="$router.back()" />
{{ productobj.proname }}
<van-action-bar>
  <van-action-bar-icon icon="chat-o" text="客服" color="#ee0a24" />
  <van-action-bar-icon icon="cart-o" text="购物车"  @click="addshopchakanCart"/>
  <van-action-bar-icon icon="star-o" text="已收藏" color="#ff5000" />
  <van-action-bar-button type="warning" text="加入购物车" @click="addshopjiaruCart" />
  <van-action-bar-button type="danger" text="立即购买" />
</van-action-bar>
</template>
<script>
import { JiaruGouwucheRequset } from '@/api/gouwucheApi';
import { ChakanGouwucheRequset } from '@/api/gouwucheApi';
import { productXiangqingRequset } from '../../api/homeApi';

export default {
    data() {
        return {
            productobj: {},
        }
    },
    methods:{
      addshopjiaruCart(){
        JiaruGouwucheRequset(this.$route.query.id).then((res)=>{
          console.log(res);
        })
      },
      addshopchakanCart(){
        ChakanGouwucheRequset(this.$route.query.id).then((res)=>{
          console.log(res);
          this.$router.push("/gouwuche");
        })
        }

  },
  async mounted() {
      let r = await productXiangqingRequset(this.$route.query.id);
      console.log(r.data);
      this.productobj = r.data.data;

    }
}
</script>
<style lang="css" scoped>

</style>
